package com.staka.website.pages.user;

import org.apache.tapestry5.alerts.AlertManager;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.hibernate.annotations.CommitAfter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import com.staka.website.entities.User;


public class Registration {
	
	@Property
	private User user;
	
	@Inject
	private Session session;
	
	@InjectComponent
	private Zone zone;
	
	@Inject
	private AlertManager alertmanager;
	
	@CommitAfter
	Object onSuccess(){
		session.save(user);
		alertmanager.info(user.getFirstname()+", you are sucessfully registered, go to your e-mail address. You receievd email from us..");
		return null;
	}
}
